import test from 'ava';
import * as actions from '../../src/javascript/modules/tab/action';

test('addTab', t => {
  t.is(actions.ADD_TAB, 'ADD_TAB');
  t.same(actions.addTab({ id: 1, name: 'tabName' }),
                { type: actions.ADD_TAB,
                  tab: {
                    id: 1,
                    name: 'tabName',
                  },
                });
});

test('selectTab', t => {
  t.is(actions.SELECT_TAB, 'SELECT_TAB');
  t.same(actions.selectTab('name'),
         { type: 'SELECT_TAB',
           name: 'name' });
});

test('previousTab', t => {
  t.is(actions.PREVIOUS_TAB, 'PREVIOUS_TAB');
  t.same(actions.previousTab(),
         { type: actions.PREVIOUS_TAB });
});

test('nextTab', t => {
  t.is(actions.NEXT_TAB, 'NEXT_TAB');
  t.same(actions.nextTab(),
         { type: actions.NEXT_TAB });
});

test('removeTab', t => {
  t.is(actions.REMOVE_TAB, 'REMOVE_TAB');
  t.same(actions.removeTab(1),
              { type: actions.REMOVE_TAB, id: 1 });
});

test('editTab', t => {
  t.is(actions.EDIT_TAB, 'EDIT_TAB');
  t.same(actions.editTab(1, { name: 'updatedName' }),
              { type: actions.EDIT_TAB,
                 id: 1, payload: { name: 'updatedName' } });
});
